const connect = require('connect');
const morgan = require('morgan');
const compression = require('compression');
const serveStatic = require('serve-static');
const path = require('path');

const root = path.join(__dirname, 'public');

const app = connect()
  .use(morgan('dev'))
  .use(
    compression({
      filter(req, res) {
        const type = res.getHeader('content-type') || '';
        return type.indexOf('text/plain') == 0;
      }
    })
  )
  .use(serveStatic(root));

app.listen(3000);
